package com.fanqiechaodan.state;

/**
 * @author fanqiechaodan
 * @Classname Context
 * @Description 环境类
 */
public class Context {

    private State state;

    public Context() {
        // 默认静止状态
        this.state = new IdleState();
    }

    public void setState(State state) {
        this.state = state;
    }

    /**
     * 移动
     */
    public void move() {
        state.move();
    }

    /**
     * 攻击
     */
    public void attack() {
        state.attack();
    }
}
